import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts

// TextField - Input Limit
Rectangle {
    Layout.fillWidth: true
    Layout.fillHeight: true

    Column {
        spacing: 20
        anchors.centerIn: parent
        width: parent.width * 0.8

        // 限制最大长度
        TextField {
            id: maxLengthField
            width: parent.width
            height: 30
            placeholderText: "最多10个字符"
            maximumLength: 10

            // 背景框
            background: Rectangle {
                border.color: "#c0c0c0"
                border.width: 1
                radius: 4
            }
        }

        // 密码输入框
        TextField {
            id: passwordField
            width: parent.width
            height: 30
            placeholderText: "请输入密码"
            echoMode: TextField.Password
            passwordCharacter: "*"

            // 背景框
            background: Rectangle {
                border.color: "#c0c0c0"
                border.width: 1
                radius: 4
            }
        }

        // 只读文本框
        TextField {
            id: readOnlyField
            width: parent.width
            height: 30
            text: "只读内容"
            readOnly: true

            // 背景框
            background: Rectangle {
                border.color: "#c0c0c0"
                border.width: 1
                radius: 4
            }
        }
    }
}
